/**
 * 
 */
package truerefactor.metrics;

import truerefactor.graph.CodeGraph;
import truerefactor.ui.DisplayInfo;

/**
 * Metric - The base class from which all metrics can be derived. This is used
 * to form the base of the Strategy Pattern used in the metrics suite.
 * 
 * @author Isaac Griffith
 */
public abstract class Metric implements DisplayInfo {

    /**
     * The full name of the metric
     */
    protected String name;
    /**
     * An acronym for the metric
     */
    protected String shortName;
    /**
     * A short description of the metric
     */
    protected String description;

    /**
     * Measures the provide metric over an entire code graph representation of a
     * codebase
     * 
     * @param graph
     *            code graph representing the code base over which this metric
     *            is to be measured
     * @return the measure value of the metric (as averaged over the number of
     *         classes in the codebase)
     */
    public abstract double measure(CodeGraph graph);

    /*
     * (non-Javadoc)
     * @see truerefactor.refactor.DisplayInfo#getName()
     */
    @Override
    public String getName()
    {
        return name;
    }

    /*
     * (non-Javadoc)
     * @see truerefactor.refactor.DisplayInfo#getDescription()
     */
    @Override
    public String getDescription()
    {
        return description;
    }

    /*
     * (non-Javadoc)
     * @see truerefactor.ui.DisplayInfo#getShortName()
     */
    @Override
    public String getShortName()
    {
        return shortName;
    }
}
